<template>
  <div id="app">
    <Layout v-if="logined"/>
    <Login v-else/>
  </div>
</template>

<script>
import Layout from "@/layout";
import Login from "@/views/common/login.vue";
export default {
  name: "App",
  components: { Layout, Login },
  data() {
    return {};
  },
  computed: {
    logined() {
      return this.$store.getters.user_is_logined;
    }
  },
  watch: {
    $route() {}
  },
  mounted() {
    //  页面刷新的时候 vuex 里面的数据会丢失 重新加载 menus
    if (Cookies.get("token")) {
      this.$store.commit("SET_USER_LOGINED", true);
      //  获取菜单
      this.$store.dispatch("SET_USER_MENUS");
    }
  },
  methods: {}
};
</script>

<style lang="scss" type="text/css" scoped>
#app {
  height: 100%;
  min-height: 600px;
  // border: 1px solid red;
}
</style>
